package mobi.greenplate.client.handler;

import mobi.greenplate.client.converter.CommunityConverter;
import mobi.greenplate.client.domain.Community;
import mobi.greenplate.client.parser.DomainHandler;

/**
 *
 * @author dmakariev
 */
public class CommunityHandler extends DomainHandler<Community> {

    private static final String COMMUNITY_ROOT = "//community";
    private Community community = new Community();

    @Override
    public Community getEntity() {
        return community;
    }

    @Override
    public void endTag(String parentPath, String tagName, String text) {
        if (COMMUNITY_ROOT.equalsIgnoreCase(parentPath)) {
            community = CommunityConverter.endTag(community, tagName, text);
        }
    }

    @Override
    public void startTag(String parentPath, String tagName) {
        //do nothing
    }
}
